package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MeetingRecordm;
import com.ruoyi.system.service.IMeetingRecordmService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会议记录Controller
 * 
 * @author ruoyi
 * @date 2025-07-01
 */
@Controller
@RequestMapping("/system/recordm")
public class MeetingRecordmController extends BaseController
{
    private String prefix = "system/recordm";

    @Autowired
    private IMeetingRecordmService meetingRecordmService;

    @RequiresPermissions("system:recordm:view")
    @GetMapping()
    public String recordm()
    {
        return prefix + "/recordm";
    }

    /**
     * 查询会议记录列表
     */
    @RequiresPermissions("system:recordm:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MeetingRecordm meetingRecordm)
    {
        startPage();
        List<MeetingRecordm> list = meetingRecordmService.selectMeetingRecordmList(meetingRecordm);
        return getDataTable(list);
    }

    /**
     * 导出会议记录列表
     */
    @RequiresPermissions("system:recordm:export")
    @Log(title = "会议记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MeetingRecordm meetingRecordm)
    {
        List<MeetingRecordm> list = meetingRecordmService.selectMeetingRecordmList(meetingRecordm);
        ExcelUtil<MeetingRecordm> util = new ExcelUtil<MeetingRecordm>(MeetingRecordm.class);
        return util.exportExcel(list, "会议记录数据");
    }

    /**
     * 新增会议记录
     */
    @RequiresPermissions("system:recordm:add")
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存会议记录
     */
    @RequiresPermissions("system:recordm:add")
    @Log(title = "会议记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(MeetingRecordm meetingRecordm)
    {
        return toAjax(meetingRecordmService.insertMeetingRecordm(meetingRecordm));
    }

    /**
     * 修改会议记录
     */
    @RequiresPermissions("system:recordm:edit")
    @GetMapping("/edit/{recordId}")
    public String edit(@PathVariable("recordId") Long recordId, ModelMap mmap)
    {
        MeetingRecordm meetingRecordm = meetingRecordmService.selectMeetingRecordmByRecordId(recordId);
        mmap.put("meetingRecordm", meetingRecordm);
        return prefix + "/edit";
    }

    /**
     * 修改保存会议记录
     */
    @RequiresPermissions("system:recordm:edit")
    @Log(title = "会议记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(MeetingRecordm meetingRecordm)
    {
        return toAjax(meetingRecordmService.updateMeetingRecordm(meetingRecordm));
    }

    /**
     * 删除会议记录
     */
    @RequiresPermissions("system:recordm:remove")
    @Log(title = "会议记录", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(meetingRecordmService.deleteMeetingRecordmByRecordIds(ids));
    }
}
